/**
 * Created with Intellij JDEA
 * Description:
 * User:
 * Date:2022-04-26
 * Time:14:33
 */
public class 三维形体投影面积 {
    class Solution {
        public int projectionArea(int[][] grid) {
            int xy = 0,yz = 0, xz = 0;
            for(int i = 0;i < grid.length;i++) {
                int yzHeigh = 0,xzHeigh = 0;
                for(int j = 0;j < grid.length;j++) {
                    if(grid[i][j] > 0) {
                        xy++;
                    }
                    xzHeigh = Math.max(xzHeigh,grid[i][j]);
                    yzHeigh = Math.max(yzHeigh,grid[j][i]);
                }
                xz += xzHeigh;
                yz += yzHeigh;
            }
            return xz+yz+xy;
        }
    }
}